home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 26 / AACD 26.iso / AACD / Online / PHP / include / php / ext / xml / php_xml.h
Encoding:
C/C++ Source or Header  |  2001-02-26  |  4.6 KB  |  176 lines

  1. /*
  2.    +----------------------------------------------------------------------+
  3.    | PHP version 4.0                                                      |
  4.    +----------------------------------------------------------------------+
  5.    | Copyright (c) 1997-2001 The PHP Group                                |
  6.    +----------------------------------------------------------------------+
  7.    | This source file is subject to version 2.02 of the PHP license,      |
  8.    | that is bundled with this package in the file LICENSE, and is        |
  9.    | available at through the world-wide-web at                           |
  10.    | http://www.php.net/license/2_02.txt.                                 |
  11.    | If you did not receive a copy of the PHP license and are unable to   |
  12.    | obtain it through the world-wide-web, please send a note to          |
  13.    | license@php.net so we can mail you a copy immediately.               |
  14.    +----------------------------------------------------------------------+
  15.    | Authors: Stig Sæther Bakken <ssb@fast.no>                            |
  16.    |          Thies C. Arntzen <thies@thieso.net>                         |
  17.    +----------------------------------------------------------------------+
  18. */
  19.  
  20. /* $Id: php_xml.h,v 1.16 2001/02/26 06:07:25 andi Exp $ */
  21.  
  22. #ifndef PHP_XML_H
  23. #define PHP_XML_H
  24.  
  25. #ifdef HAVE_LIBEXPAT
  26.  
  27. extern zend_module_entry xml_module_entry;
  28. #define xml_module_ptr &xml_module_entry
  29.  
  30. #else
  31.  
  32. #define xml_module_ptr NULL
  33.  
  34. #endif
  35.  
  36. #if defined(HAVE_LIBEXPAT) && defined(PHP_XML_INTERNAL)
  37.  
  38. #ifdef HAVE_LIBEXPAT2
  39. #include <expat.h>
  40. #else
  41. #include <xmltok.h>
  42. #include <xmlparse.h>
  43. #endif
  44.  
  45. #ifdef PHP_WIN32
  46. #define PHP_XML_API __declspec(dllexport)
  47. #else
  48. #define PHP_XML_API
  49. #endif
  50.  
  51.  
  52. #ifdef XML_UNICODE
  53. #error "UTF-16 Unicode support not implemented!"
  54. #endif
  55.  
  56. typedef struct {
  57.     XML_Char *default_encoding;
  58. } php_xml_globals;
  59.  
  60. typedef struct {
  61.     int index;
  62.     int case_folding;
  63.     XML_Parser parser;
  64.     XML_Char *target_encoding;
  65.     zval *startElementHandler;
  66.     zval *endElementHandler;
  67.     zval *characterDataHandler;
  68.     zval *processingInstructionHandler;
  69.     zval *defaultHandler;
  70.     zval *unparsedEntityDeclHandler;
  71.     zval *notationDeclHandler;
  72.     zval *externalEntityRefHandler;
  73.     zval *unknownEncodingHandler;
  74. #ifdef HAVE_LIBEXPAT2
  75.     zval *startNamespaceDeclHandler;
  76.     zval *endNamespaceDeclHandler;
  77. #endif
  78.     zval *object;
  79.  
  80.     zval *data;
  81.     zval *info;
  82.     int level;
  83.     int toffset;
  84.     int curtag;
  85.     pval **ctag;
  86.     char **ltags;
  87.     int lastwasopen;
  88.     int skipwhite;
  89.     
  90.     XML_Char *baseURI;
  91. } xml_parser;
  92.  
  93.  
  94. typedef struct {
  95.     XML_Char *name;
  96.     char (*decoding_function)(unsigned short);
  97.     unsigned short (*encoding_function)(unsigned char);
  98. } xml_encoding;
  99.  
  100.  
  101. enum php_xml_option {
  102.     PHP_XML_OPTION_CASE_FOLDING = 1,
  103.     PHP_XML_OPTION_TARGET_ENCODING,
  104.     PHP_XML_OPTION_SKIP_TAGSTART,
  105.     PHP_XML_OPTION_SKIP_WHITE
  106. };
  107.  
  108. #define RETURN_OUT_OF_MEMORY \
  109.     php_error(E_WARNING, "Out of memory");\
  110.     RETURN_FALSE
  111.  
  112. /* for xml_parse_into_struct */
  113.     
  114. #define XML_MAXLEVEL 255 /* XXX this should be dynamic */
  115.     
  116. PHP_FUNCTION(xml_parser_create);
  117. #ifdef HAVE_LIBEXPAT2
  118. PHP_FUNCTION(xml_parser_create_ns);
  119. #endif
  120. PHP_FUNCTION(xml_set_object);
  121. PHP_FUNCTION(xml_set_element_handler);
  122. PHP_FUNCTION(xml_set_character_data_handler);
  123. PHP_FUNCTION(xml_set_processing_instruction_handler);
  124. PHP_FUNCTION(xml_set_default_handler);
  125. PHP_FUNCTION(xml_set_unparsed_entity_decl_handler);
  126. PHP_FUNCTION(xml_set_notation_decl_handler);
  127. PHP_FUNCTION(xml_set_external_entity_ref_handler);
  128. #ifdef HAVE_LIBEXPAT2
  129. PHP_FUNCTION(xml_set_start_namespace_decl_handler);
  130. PHP_FUNCTION(xml_set_end_namespace_decl_handler);
  131. #endif
  132. PHP_FUNCTION(xml_parse);
  133. PHP_FUNCTION(xml_get_error_code);
  134. PHP_FUNCTION(xml_error_string);
  135. PHP_FUNCTION(xml_get_current_line_number);
  136. PHP_FUNCTION(xml_get_current_column_number);
  137. PHP_FUNCTION(xml_get_current_byte_index);
  138. PHP_FUNCTION(xml_parser_free);
  139. PHP_FUNCTION(xml_parser_set_option);
  140. PHP_FUNCTION(xml_parser_get_option);
  141. PHP_FUNCTION(utf8_encode);
  142. PHP_FUNCTION(utf8_decode);
  143. PHP_FUNCTION(xml_parse_into_struct);
  144.  
  145. PHPAPI char *_xml_zval_strdup(zval *val);
  146. PHPAPI char *xml_utf8_decode(const XML_Char *, int, int *, const XML_Char *);
  147.  
  148. #endif /* HAVE_LIBEXPAT */
  149.  
  150. #define phpext_xml_ptr xml_module_ptr
  151.  
  152. #ifdef ZTS
  153. #define XMLLS_D php_xml_globals *xml_globals
  154. #define XMLLS_DC , PSLS_D
  155. #define XMLLS_C xml_globals
  156. #define XMLLS_CC , XMLLS_C
  157. #define XML(v) (xml_globals->v)
  158. #define XMLLS_FETCH() php_xml_globals *xml_globals = ts_resource(xml_globals_id)
  159. #else
  160. #define XMLLS_D
  161. #define XMLLS_DC
  162. #define XMLLS_C
  163. #define XMLLS_CC
  164. #define XML(v) (xml_globals.v)
  165. #define XMLLS_FETCH()
  166. #endif
  167.  
  168. #endif /* PHP_XML_H */
  169.  
  170. /*
  171.  * Local variables:
  172.  * tab-width: 4
  173.  * c-basic-offset: 4
  174.  * End:
  175.  */
  176.